<!-- 产品列表 -->
<template>
    <div style="padding: 16px;">
      <div style="display: flex;align-items: center;padding-left: 12px 0;">
        <el-input v-model="searchText" placeholder="请输入内容" style="max-width: 220px;margin-right: 16px;" />
        <el-button type="primary" icon="el-icon-search" @click="onSearch">搜索</el-button>
        <el-button type="primary" icon="el-icon-add" @click.native="addHandle">添加产品</el-button>
      </div>
      <ServiceTable :data="items" @editHandle="editHandle" @refreshList="netGetList"/>
      <!-- add -->
      <el-dialog
        title="添加分类"
        :visible.sync="openAdd"
        :before-close="handleClose">
        <AddCom @onClose="netGetList()"/>
        <!-- <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="dialogVisible = false">完 成</el-button>
        </span> -->
      </el-dialog>
  
      <!-- edit -->
      <el-dialog
        title="编辑分类"
        :visible.sync="openEdit"
        :before-close="handleClose">
        <EditCom @onClose="netGetList()" :row="currentData"/>
      </el-dialog>
    </div>
  </template>
  
  <script>
  import ServiceTable from './service_table.vue'
  import AddCom from "./cate_add.vue"
  import EditCom from "./cate_edit.vue"
import ServiceApi from './api'
  export default {
    components: {
      ServiceTable,
      AddCom,
      EditCom,
    },
    data() {
      return {
        activeName: 'first',
        name: '我要下单',
        openAdd:false,
        openEdit:false,
        items:[],
        currentData:{},
        searchText: ''
      }
    },
    mounted() {
      this.netGetList();
    },
  
    methods:{
      async netGetList() {
        var res = await ServiceApi.netYzServiceGetList({ queryBean: { searchText: this.searchText } });
        let body = res['data']
        let {data} = body;
        this.openAdd = false;
        this.items = data;
      },
  
      addHandle() {
        this.$router.push({name:"goods_add"});
      },
      editHandle({data}) {
        // this.currentData = data;
        // this.openEdit = true;
        this.$router.push({name:"goods_edit",params:data});
      },
      onSearch() {
        this.netGetList();
      },
    },
  }
  </script>
  
  <style>
  .deleteBorder .el-tabs__nav-wrap::after{
      height: 0;
    }
  </style>
  